package com.hxkj.cst.chengshuitong.presenter

import android.content.Context
import com.hxkj.cst.chengshuitong.control.LoginControl
import com.hxkj.cst.chengshuitong.getDataFromShared
import com.hxkj.cst.chengshuitong.model.ServiceResultModel

/**
 * 作者： Luoyang on 2017/5/27.
 * 描述：
 */
class LoginPresenter(val view: LoginControl.View, val context: Context) : LoginControl.Presenter {

    override fun login(phone: String, password: String) {
        val userPhone = context.getDataFromShared("phone", "18981443691")
        val userPassword = context.getDataFromShared("password", "123456")

        if (phone == userPhone && password == userPassword)
            view.loginResult(ServiceResultModel.SUCCESS)
        else view.loginResult(ServiceResultModel.FAILED)
    }
}